Data migration - development to production - OrientDb - orientdb

I'm using an orientdb server for developments. Work great. Has classes, about to add support for files, etc. I'm about to provision a server on Azure for orientdb for testing by external people.
Question is
What is the database migration plan as in how to move data between the test database and the development database? Currently, it is just data but soon files will be added. coming from EF background

you can simply make a copy of db folder from test instance to develop.
Alternatively you can do an export (in.gz format) from test and then import in develop

Related

EF Core SQLite on Mac and Windows with Publish to Azure

I'm looking for an improved solution for cross platform EF Core local dev with stage/production publish to Azure Web/SQL.
Current Local Solution:
I have an ASP.NET Core, EF Core, Identity, MVC 6 app with local development on MacOS and Windows using SQLite. SQLite was chosen as I believe it's the only stable db provider for both Mac and Windows. Each time a change is made that requires a database migration we run a script that
1) Deletes the local SQLite database(s) and the existing migration and ContextModelSnapshot files
2) Creates an "initial" migration
3) Updates the database
4) The windows version of the script moves the SQLite databases to the wwwroot directory as we use IIS Express on Windows
Note: Migrations folder is ignored in .gitignore
For local dev the solution is working.
When I publish to Azure we:
1) Comment out the services.AddEntityFramework() .AddSQLite() connections and switch to the SQLServer connections
2) Run a script to create a fresh migration (as the migration generated for SQLite doesn't work on Azure SQL)
3) Run a script to delete the database tables on SQL Azure
4) Publish
5) Switch config back to SQLite and continue local dev
I'm hoping someone can suggest a better solution that eliminates most of the manual steps as well as handle the scenario when we have staging/production databases that we want to migrate instead of delete.
It seems like the only correct solution is environment specific methods in Startup.cs as described.
Basically you create ConfigureDevelopmentServices() method and add your environment specific configuration there.

Synchronizing EF Code First to SQL Azure

I am trying to find the best way to synchronize/migrate EF Code First databases from localhost to SQL Azure without using EFCF Migrations. I know that I could use this approach, but I want to look at different, less automagic options.
The following process, or variations of such, is the one I'd like to follow:
Develop locally, letting EFCF build the databse on localhost
Synchronize the local database with the stage database on SQL Azure using some tool
Run tests in the staging environment
Synchronze/migrate the database (local or stage) to the production database on SQL Azure
Using MySQL, this is a breeze. The MySQL Workbench can synchronize a schema model to the database in question, plain and simple. In this case, I don't have a schema model per se, but the database on localhost generated by EFCF could be concidered the schema.
Which tools are available to perform this task? Is it possible to do this using SSMS?
Update: How I did it:
After the tip from Craig to use a Visual Studio 2012 Database Project, I did the following:
Created an empty VS 2012 database project and set its target platform to SQL Azure
Did a new schema compare, source database = local db and target = database project
Updated the target. This brought the database project up to speed
Did a new compare, source= database project and target = SQL Azure stage db
Updated the target. This brought the SQL Azure stage db up to speed
This was exactly what I was looking for
The Visual Studio 2012 database project can do it, I do it all the time.
It's not free, but Red-Gate's SQL Compare would handle the schema replication

SQL Server Data Tools and Edmx

So we're using the new SSDT Microsoft released, pretty cool stuff. We are keeping a database project under version control with all the schemas, and an offline database for development and we can later deploy on SQL Azure database. We;re using EF in development, so my question is where would the edmx fit in, should we update the edmx file from the offline database or from the online SQL Azure directly, whats the best practice on this?
I would say that in your case "the production database is the truth", so I would update from SQL Azure. There's no right answer tho really.
Incidentally, in the early betas of SSDT it was possible to have a reference from an EDMX to a SSDT project thus your source code became the truth (which, in my opinion, is preferable) and the EDMX knew it was always working against "the truth". Unfortunately they ditched this feature and there are no signs of it returning.
For the EF to work correctly the EDMX file has to be in-synch with the database you are connecting to. It's hard to answer your question without knowing the development process you follow but I would imagine you use Sql Azure in production and develop against an on-premises database. Therefore one copy of the Edmx file will be used on production server. In the development environment you have a "living" copy of the edmx file that is changed as needed when the local database changes. When you get to the point you when you are ready to ship you deploy your app (include the edmx file) to a production environment that uses Sql Azure.
If, in your development environment, you update the edmx file from the SQL Azure then stuff will break or will not work correctly if the schema of the database in Azure is different from schema of your local database.

Deploy Entity Framework Code First

I guess I should have thought of this before I started my project but I have successfully built and tested a mini application using the code-first approach and I am ready to deploy it to a production web server.
I have moved the folder to my staging server and everything works well. I am just curious if there is a suggested deployment strategy?
If I make a change to the application I don't want to lose all the data if the application is restarted.
Should I just generate the DB scripts from the code-first project and then move it to my server that way?
Any tips and guide links would be useful.
Thanks.
Actually database initializer is only for development. Deploying such code to production is the best way to get some troubles. Code-first currently doesn't have any approach for database evolution so you must manually build change scripts to your database after new version. The easiest approach is using Database tools in VS Studio 2010 Premium and Ultimate. If you will have a database with the old schema and a database with the new schema and VS will prepare change script for you.
Here are the steps I follow.
Comment out any Initialization strategy I'm using.
Generate the database scripts for schema + data for all the tables EXCEPT the EdmMetadata table and run them on the web server. (Of course, if it's a production server, BE CAREFUL about this step. In my case, during development, the data in production and development are identical.)
Commit my solution to subversion which then triggers TeamCity to build, test, and deploy to the web server (of course, you will have your own method for this step, but somehow deploy the website to the web server).
You're all done!
The Initializer and the EdmMetadata tables are needed for development only.

How to deploy local Strapi content to Heroku

I have a local version of Strapi set up, and the codebase is pushing fine to Netlify for the frontend and Heroku for the backend.
However, I can't work out how to get the content held in the .tmp/data.db file into the mLab instance of the database on Heroku.
The structure is all in sync with my local version.
I've tried to export tables from SQL Lite to JSON files and then import them as collections using the CLI - which says it's imported the documents into Heroku (and I can see them in the mLab interface), but this was a last ditched attempt as I couldn't see a way of transferring the entire file.
However, this isn't working as the content types are still empty.
Make sure you well configured your ./config/environments/production/database.json with your mLab configs.
In development, you look using SQLite. This database is good for local development but can't be used in Heroku (see the storage system used by Heroku you will understand why.)
Be careful, you are using an SQL database in dev and a NoSQL database in production.
This looks special - depending on your data structure, you can have issues about the data migration. I don't suggest you to do that. Use the same type of database in dev and prod.