Giter Site home page Giter Site logo

play-migrate's People

Contributors

dcardon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

pepite ykarikos

play-migrate's Issues

"Migrate collisions detected" when the label part of the patch file name contains the letters "up"

Created patch files 28.up.myGroupPatch.sql and 28.down.myGroupPatch.sql
Ran migrate:up

Received:
Collision list:
/home/server/db/migrate/incapsula_stage1/28.down.proxyGroupActivation.sql <==> /home/server/db/migrate/incapsula_stage1/28.up.proxyGroupActivation.sql

Seems like commands.py has a bug in line 135 - the regular expression pattern '/up.sql' is too weak. It catches the "up" part of the work "Group" in the filename 28.down.proxyGroupActivation.sql, which is a downgrade patch.

Should be changed to something stronger, like: r'/\d+.up*.sql'

Failure migrations marks as successful

I use one db - PostgreSQL 9.2.9

For example, the migration script may be file with name 13.up.failure_test.sql with line: SELECT 1 FROM a;. Table a does not exist.

Output:

~/play1-1.2.7.2/play migrate:up
~ _ _
~ _ __ | | __ _ _ | |
~ | '
| |/ ' | || ||
~ | /|_|__|__ ()
~ |
| |__/
~
~ play! 1.2.7.2, http://www.playframework.org
~
~ Database migration:
~
~ Database: umbrella_mastodon (Alias:db1)
Execution: psql -U postgres -h 10.65.67.232 -p 5432 -t -d umbrella_mastodon -f /data/projects/umbrella/tmp/migrate.module/check_version.sql
~ Version: 12
~ Status: | Successful
~ Max patch version: 13
~
~ Migrating...
Execution: psql -U postgres -h 10.65.67.232 -p 5432 -t -d umbrella_mastodon -f /data/projects/umbrella/db/migrate/db1/13.up.failure_test.sql
~ 13...
Execution: psql -U postgres -h 10.65.67.232 -p 5432 -t -d umbrella_mastodon -f /data/projects/umbrella/tmp/migrate.module/update_version.sql
~
~ Migration completed successfully
~
~ ------------------------------------
~

db.properties conflict

db.properties files collides with hsql filesystem database files (db.properties for instance). one cannot therefore use the fs in test mode as well as th migrate module.

Cheers

migrating multiple databases won't work if there is a space before the db name in the conf file

If your application has multiple db's defined in the conf file, only the first db in the list will be updated if there is a space between the names. For example, if the conf file looks like:
"migrate.module.dbs=db1, db2"
patches for db2 will not be run. the database will be created but the patches aren't run. However if you modify the conf file to look like:
"migrate.module.dbs=db1,db2"
it works great. Creating both dbs and running the patches for both.

glenjr

Migrate exception when down script has the format 10.down.update_test.sql

Hi everyone,
I don't know if this module is still maintained, but I found an issue with the name matching.

Example file name: 10.down.update_test.sql

When calling migrate:up the search_path in line 153 unfortunately matches the above file name which then later can't be matched by the regex matcher.
This leads to this exception:

Traceback (most recent call last):
  File "...\play-1.5.1\play", line 159, in <module>
    status = cmdloader.commands[play_command].execute(command=play_command, app=play_app, args=remaining_args, env=play_env, cmdloader=cmdloader)
  File "...\play1app\modules\migrate-1.4\commands.py", line 425, in execute
    up()
  File "...\play1app\modules\migrate-1.4\commands.py", line 340, in up
    [maxindex, files_obj] = getMigrateFiles(db_alias,int(version))
  File "...\play1app\modules\migrate-1.4\commands.py", line 163, in getMigrateFiles
    index = int(match.group(1))
AttributeError: 'NoneType' object has no attribute 'group'
153 search_path = os.path.join(app.path, 'db/migrate/',dbname + '/*.up*.sql')
154
155     initial_list = glob.glob(search_path)
156     return_obj = {}
157     collisions = []
158     # Filter the list to only the specified pattern
159     pat = re.compile('(\d+)\.up.*\.sql\Z')
160     maxindex = 0
161     for file in initial_list:
162         match = re.search(pat,file)
163         index = int(match.group(1))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.