isapir / migrate2postgres Goto Github PK
View Code? Open in Web Editor NEWEasily migrate from other DBMSs to PostgreSQL
License: GNU General Public License v3.0
Easily migrate from other DBMSs to PostgreSQL
License: GNU General Public License v3.0
I ran the application but apparently when it creates the tables it does not know how to add a foreign key. it's that correct? or the app should know how to handle the foreign keys?
When I run migrate.sh ı got following error. Do you guys have any idea?
./migrate.sh: line 5: -Dconnections.mssql.user=readonly: command not found
./migrate.sh: line 6: -Dconnections.mssql.password=secret: command not found
Error: Could not find or load main class lib.jaxb-api-2.3.0.jar
Regards
Hi,
There is not a sql_type_mapping for image by default.
I replace it with the 'bytea' data type but I still not check it if it is works.
The missing PK, UK, FK, and Index can be added with few efforts with the reference in the following link.
https://github.com/krgsoft/SQLtoPostgresMigrationScript.
hey,
I'm trying to use your tool for migrating my project from MSSQL to Postgres,
I've been able to migrate all of the tables and the data I had but one, that has about 20 millions records in it.
while running an attempt to migrate that specific table, I get the error-
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at net.twentyonesolutions.m2pg.PgMigrator.lambda$doDml$1(PgMigrator.java:155)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.ForEachOps$ForEachTask.compute(Unknown Source)
at java.util.concurrent.CountedCompleter.exec(Unknown Source)
at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.util.concurrent.ForkJoinTask.doInvoke(Unknown Source)
at java.util.concurrent.ForkJoinTask.invoke(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.forEach(Unknown Source)
at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)
at net.twentyonesolutions.m2pg.PgMigrator.doDml(PgMigrator.java:153)
at net.twentyonesolutions.m2pg.PgMigrator.main(PgMigrator.java:83)
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(Unknown Source)
at java.lang.AbstractStringBuilder.append(Unknown Source)
at java.lang.StringBuilder.append(Unknown Source)
at net.twentyonesolutions.m2pg.Schema.copyTable(Schema.java:254)
at net.twentyonesolutions.m2pg.PgMigrator.lambda$doDml$0(PgMigrator.java:138)
at net.twentyonesolutions.m2pg.PgMigrator$$Lambda$17/6581689.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
is there any solution?
I'm trying to move a legacy application's database from sql server to postgresql. I want to maintain the casing of the table and column names. Currently this is what the script the app is generating. I have trimmed the rest for brevity sake.
CREATE TABLE public.aspnet_Applications ( ApplicationName TEXT NOT NULL ,LoweredApplicationName TEXT NOT NULL ,ApplicationId CHAR(36) NOT NULL -- DEFAULT (newid()) ,Description TEXT );
After you run the script, all the table and column names will be converted to lowercase or uppercase or snake_case depending on the format you specify in the conf file. My question is, I want to know if there is a way to allow postgresql to maintain the same format for the table and column names as it was in the sql sever?
I have a schema in file and i want to convert it into Postgre DB. Can i run the tool on a file instead of a MS SQL connection and get output using DDL command.
e.g. to disable the TRIGGERS before DML operations run:
SET session_replication_role = replica;
and then re-enable them at the end with:
SET session_replication_role = DEFAULT;
Its a powerfull and awesome tool! I'm using this tool since February, 2022. Its perfect. But I'm taking some little erros, its a little effotr in replace on notepad++, for example, in the "sql_type_mapping" section, I would like to transform timestamp to bytea and datetime2 to timestamptz, and I put this code below:
"timestamp" : "bytea",
"datetime2" : "timestamptz",
But, when I check the DDL file, the datatypes for theses coluns remaing timpestamp and datetime2, and I need put on notepad++ and replace manually.
Another problem is a comment in a column, when we have a coment like this: "--Default value for table AS 0", the part of AS 0 is broke and putted in the another line, and occuring sintax errors.
All erros are easy to fix, and I made this fix everyday, its simple to fix. If necessary, I can send you prints and files.
Hi,
is possible to reuse the batch just to update the database\table after migration?
Trying to run the DML command and I get this type of error:
org.postgresql.util.PSQLException: ERROR: relation "public.vehicle_type" does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2285)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:473)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:393)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:322)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:308)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:284)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:279)
at net.twentyonesolutions.m2pg.Schema.copyTable(Schema.java:125)
at net.twentyonesolutions.m2pg.PgMigrator.lambda$doDml$0(PgMigrator.java:210)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Hi
Thank you for this wonderful tool.
I have a huge db with camelcase tables - would love to see support for this as well since changing it now is not an option.
Thanks
In config file I see MS SQL Server authentication:
mssql : {
connectionString : "jdbc:sqlserver://localhost:1433"
,user : "%connections.mssql.user%"
,password : "%connections.mssql.password%"
,databaseName : "AdventureWorks"
How can I set Windows authentication?
Foreign keys constraints are lost between tables
Hi,
Request you to provide more information of using this tool like
Environment Windows or Linux?
Installation and configuration steps?
some sample report which are thing i can migrate or not migrate like in ora2pg we have.
details of command which we can use for migration from MSSQL to Postgres.
Thanks
Pawan
If I already had postgres schema with columns of uuid type, dml migration throws error:
Error: Insert Failed. org.postgresql.util.PSQLException: Error: column * has uuid type but expression character.
Is it possible to add DDL indexes to each table?
I understand that Postgres has very wide possibilities for creating indexes, and in fact all the created indexes probably will make sense only as btree
.
However, having a ready-made code sketch will be very useful.
Thank you.
I want to have ability to keep casing such as in target db.
It is very important thing when you need support several types of db (mssql/postgres/ets) with ORM.
I would try to make pul request to add such behavior/
Insert is failing for NULL values. Can you please help here how we can fix this issue. Below is error message.
"Insert Failed. org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x00
INSERT INTO public.ANSWER_TYPE (ID, NAME)
VALUES('1', '☺☺ ]?ùf°ß?6?FP?¬,Å?? →Cû???6-sg↔?W»');
Insert Failed. org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x00"
Hi,
I made a query to generate Pks of tables. The code is below:
SELECT DISTINCT
KCU.TABLE_SCHEMA
,KCU.TABLE_CATALOG
,KCU.TABLE_NAME
,'ALTER TABLE '+KCU.TABLE_SCHEMA + '.' + KCU.TABLE_NAME
+' CONSTRAINT '+ KCU.CONSTRAINT_NAME
+' PRIMARY KEY ("'+lower(KCU.COLUMN_NAME)+'");' as GENERATE_PK
FROM INFORMATION_SCHEMA.TABLES T
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE as KCU ON
T.TABLE_SCHEMA = KCU.TABLE_SCHEMA
AND T.TABLE_NAME = KCU.TABLE_NAME
AND T.TABLE_CATALOG = KCU.TABLE_CATALOG
AND OBJECTPROPERTY(OBJECT_ID(KCU.CONSTRAINT_SCHEMA + '.' + QUOTENAME(KCU.CONSTRAINT_NAME)), 'IsPrimaryKey') = 1
WHERE T.TABLE_CATALOG = '%information_schema.database_name%'
AND T.TABLE_TYPE = 'BASE TABLE'
AND T.TABLE_NAME NOT IN ('dtproperties')
ORDER BY 1,2,3;
I hope this code help you to increase your solution.
Tks.
`
This project doesn't appear to work with postgres 10.
After rewriting the bash script to work on my mac, the generated DDL will not execute.
How do you cast data for certain columns during the DML process? I didn't see any example for that in your video or example files. for instance, I have data type "uniqueidentifier" mapped to "uuid" and log file recommends I cast the char value to uuid ..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.