-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration #46
Comments
It is possible. You can use the migration-cli project to help you set up manually. Install migration-cli in an empty folder: composer require byjg/migration-cli Set up your environment variables export MIGRATE_CONNECTION=<YOUR CONNECTION>
export MIGRATE_PATH=/path/to/migrate_files
export MIGRATE_DISABLE_RESET=true Create an empty migration structure (it will create a base.sql, migrations/up/0001.sql and migrations/down/0000.sql) ./vendor/bin/migrate create $MIGRATE_PATH Install the migration in the database: ./vendor/bin/migrate install Now you can edit the file migrations/up/0001.sql with migrations content and run ./vendor/bin/migrate up -vvv
./vendor/bin/migrate version # Check the migration was successfully applied |
Hello @byjg Thanks for your solution. However, seeing the code I have found another solution. The migration object include a parameter for ignore the base script. Therefore, I have set this parameter as false like in the below instruction
After that, I have use these two instruction
With the first instruction, the table migration is create. Is it acceptable as a solution? There is a documentation about this library with property and methods explained? If yes, where can I find it? Thanks again. |
Yes, it is acceptable. You did it using the API, which is more than OK :)
Unfortunately, I don't have a full documentation API yet.
…On Mon, Nov 21, 2022 at 3:26 AM testlorenzospa ***@***.***> wrote:
Hello @byjg <https://github.com/byjg>
Thanks for your solution.
However, seeing the code I have found another solution.
The migration object include a parameter for ignore the base script.
Therefore, I have set this parameter as false like in the below instruction
$migration = new \ByJG\DbMigration\Migration($connectionUri,
'/forlder/for/migration', false);
After that, I have use these two instruction
$migration->createVersion(); $migration->update($upVersion = null);
With the first instruction, the table migration is create.
With the second instruction, I can update the database without recreate it.
Is it acceptable as a solution?
There is a documentation about this library with property and methods
explained? If yes, where can I find it?
Thanks again.
—
Reply to this email directly, view it on GitHub
<#46 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHPXJDQNTNPW7KH5E72M4TWJM53ZANCNFSM6AAAAAASETH3AA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@byjg I have question about supporting of cross-database migration, I mean do some stuff with data from two or more source, it is available with that library? |
You can have as many sources you want, since each one has your OWN directory structure for migration. e.g.
We don't have a single migration file doing different sources. Do you have a use case I can consider? |
@byjg Hello! I mean can we fetch data from one database and based on foreign key relation do update in second database within one migration file? |
It is possible if:
e.g. insert into firstdb.table select * from seconddb.table; NOTE:
|
Hello.
I want to use this library.
But I don't understant something.
If I already have a database (that I don't want to reset) can I update it using this library without a base SLQ script? If yes, how?
Thansk.
The text was updated successfully, but these errors were encountered: