database-migration

Using EF4 migration tool with model-first approach

与世无争的帅哥 提交于 2019-11-30 12:45:03
EF migration utility seems quite nice when using code first. Based on this blog post , I tried setting it in my project where we use model-first. When running Enable-Migrations command, I get the following error: Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel. Is there any way around it so we can use the EF migration without switching to code-first? I have an incomplete blog entry on how you could do this. Not sure

Postgres on Rails FATAL: database does not exist

前提是你 提交于 2019-11-30 12:30:45
问题 I've reinstalled Postgres (9.2.4) and I'm having trouble getting it set back up with Rails 3.2.11. I did: brew install postgresql initdb /usr/local/var/postgres pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start So now I have $ psql --version psql (PostgreSQL) 9.2.4 $ which psql /usr/local/bin/psql My database.yml file looks like development: adapter: postgresql encoding: unicode database: myapp_development pool: 5 username: Tyler password: host: localhost port:

EF Core Add Migration Debugging

眉间皱痕 提交于 2019-11-30 11:53:53
How can I step into OnModelCreating with a breakpoint and see if my logic is wrong or if the ModelBuilder is doing something I'm not expecting? I've seen lots of posts on how to debug the actual migration, but nothing on how to watch how the model code is being generated. I'm trying to implement some custom attributes on some of my entities, and it's being ignored; I'd like to see what my configuration is doing as it's generating the model code. You should be able to call Debugger.Launch() in your code. The just-in-time debugger should prompt you to attach a debugger when it hits that line. 来源

Laravel: Run migrations on another database

不羁岁月 提交于 2019-11-30 11:36:45
In my app every user has its own database that created when user registered. Connection and database data (database name, username, password) are saved in a table in default database. try{ DB::transaction(function() { $website = new Website(); $website->user_id = Auth::get()->id; $website->save(); $database_name = 'website_'.$website->id; DB::statement(DB::raw('CREATE DATABASE ' . $database_name)); $websiteDatabase = new WebsiteDatabase(); $websiteDatabase->website_id = $website->id; $websiteDatabase->database_name = $database_name; $websiteDatabase->save(); }); } catch(\Exception $e) { echo

How to migrate from SQLite to PostgreSQL (Rails)

寵の児 提交于 2019-11-30 11:34:57
I'm a DB noob so please be kind with me. I'm having some issues pushing my SQLite DB to Heroku via taps gem. Talking with them, they told me one of the solutions could be converting locally my DB from SQLite to PostgreSQL. Is there an easy way to do so? Thanks More info: - DB from Rails app - I'm on Mac OS X - Just installed PostgreSQL via macports sqlite3 development.db .dump | psql dbname username Sequel will help you gem install sequel sequel -C sqlite://db/development.sqlite3 postgres://username:password@localhost/dbname 来源: https://stackoverflow.com/questions/4248072/how-to-migrate-from

Ways to manage DB migrations with SQLAlchemy? [closed]

会有一股神秘感。 提交于 2019-11-30 11:18:05
I've looked at sqlalchemy-migrate, but it just seems like a lot of work and I haven't been able to find any useful examples. Anyone care to share how they handle this? Check out new project Alembic: http://readthedocs.org/docs/alembic/en/latest/index.html I don't have any personal experience with sqlalchemy-migrate , but here's a tutorial: http://caneypuggies.alwaysreformed.com/wiki/DevelopingWithMigrations If you use the scripts mentioned there, you can create migrations like this: ./new_migration.sh "Describe the new migration here" I do all my migrations with South: http://south.aeracode

Make column not nullable in a Laravel migration

喜夏-厌秋 提交于 2019-11-30 10:32:05
问题 I'm writing a migration to make certain columns in a table nullable right now. For the down function, I of course want to make those columns not nullable again. I looked through the schema builder docs, but couldn't see a way to do this. Any help would be appreciated. 回答1: Prior to Laravel 5 there was no Laravel native way of altering an existing table column using the schema builder. You'd need to use raw queries for this. However, as of Laravel 5 you can use: $table->...->nullable(false)-

“Error loading plugin manager: TomcatGrailsPlugin” on Grails 2.3 Database Migration

99封情书 提交于 2019-11-30 06:29:05
问题 I use Grails 2.3 and the Grails database migration plugin (1.3.6). When I do grails dbm-update I get the following error. How can I solve this error? Error Error loading plugin manager: TomcatGrailsPlugin (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.) java.lang.ClassNotFoundException: TomcatGrailsPlugin at _GrailsBootstrap_groovy$_run_closure2.doCall(_GrailsBootstrap_groovy:40) at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133) at org.codehaus

ProgrammingError: relation 'blah blah' does not exist, trying to run the specific migration and get error

允我心安 提交于 2019-11-30 06:05:17
问题 I am getting an error: $ python manage.py migrate swsite 0023_hitcounter.py Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line utility.execute() File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib64

No changes detected in Alembic autogeneration of migrations with Flask-SQLAlchemy

巧了我就是萌 提交于 2019-11-30 05:01:20
I'm having trouble getting Alembic to autogenerate candidate migrations from changes to classes using db.Model (Flask-SQLAlchemy) instead of Base . I've modified env.py to create my Flask app, import all relevant models, initialize the database, and then run migrations: ... uri = 'mysql://user:password@host/dbname?charset=utf8' app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = uri app.config['SQLALCHEMY_ECHO'] = True db.init_app(app) with app.test_request_context(): target_metadata = db.Model.metadata config.set_main_option('sqlalchemy.url', uri) if context.is_offline_mode(): run