Skip to content
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

Room migration using .sql files #13

Open
spurdow opened this issue Nov 10, 2020 · 4 comments
Open

Room migration using .sql files #13

spurdow opened this issue Nov 10, 2020 · 4 comments

Comments

@spurdow
Copy link

spurdow commented Nov 10, 2020

Hello @MatrixDev -

Would it be possible to have a support to pull .sql files to use as migration?

Thanks

@MatrixDev
Copy link
Owner

hello @spurdow. what do you mean by "pulling sql files"?

@spurdow
Copy link
Author

spurdow commented Nov 11, 2020

Hello @MatrixDev -
Btw - firstly thanks. This library greatly helps us.

I mean instead migrating by adding migration codes, Is it possible to store .sql files in asset/ or any configurable folder in AS and then the lib will automatically pull that depending on the db schema version like 1.sql , 2.sql so on and so forth.

Similar to the then ActiveAndroid https://github.com/pardom-zz/ActiveAndroid which is amazing.
Thanks

@MatrixDev
Copy link
Owner

MatrixDev commented Nov 12, 2020

@spurdow, glad you've liked this library.
So from what I understood those *.sql files will just contain plain SQL commands to alter database.

For example instead of writing:

@FieldMigrationRule(version1 = 3, version2 = 4, table = "Object1Dbo", field = "intValRenamed")
fun migrate_3_4_Object1Dbo_intVal(): String {
	return "`Object1Dbo`.`intVal`"
}

You'll have 3-4.sql file containing SQL script to execute?

ALTER TABLE Items ADD COLUMN color INTEGER;

@spurdow
Copy link
Author

spurdow commented Nov 14, 2020

@MatrixDev
Yes - or 4.sql will do I guess?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants