different databases using CakePHP plugin Migration - cakephp

I'm using plugin Migration from CakePHP and I have two databases in my app,
db1 (default)
tableX1
tableX2
tableX3
...
tableXn
db2
tableY1
tableY2
tableY3
...
tableYn
I want to run Migration that one part must be executed in db1 and other part in db2, how can I do this?

I'd setup different database configurations in your app/Config/database.php

Related

how to mirror a whole database cluster in postgresql

I'm using a postgresql (9.6) database in my project which is currently in development stage.
For production I want to use an exact copy/mirror of the database-cluster with a slightly different name.
I am aware of the fact that I can make a backup and restore it under a different cluster-name, but is there something like a mirror function via the psql client or pgAdmin (v.4) that mirrors all my schemas and tables and puts it in a new clustername?
In PostgreSQL you can use any existing database (which needs to be idle in order for this to work) on the server as a template when you want to create a new database with that content. You can use the following SQL statement:
CREATE DATABASE newdb WITH TEMPLATE someDbName OWNER dbuser;
But you need to make sure no user is currently connected or using that database - otherwise you will get following error.
ERROR: source database "someDbName" is being accessed by other users
Hope that helped ;)

symfony - creating database with doctrine

let say, my database name = television
everytime I try to craate database in CLEAN symfony project (I try version 2.3 or 2.5) for developer mode, it still create database "television" .. when I try to create database for production mode, it's trying to make database with same name "television"
in developer mode it should create database "television_dev", not "television"
I had one cloned project (sylius), and in this project creating databases works fine ... I try to make sure, I have all bundles same (I mean doctrine versions), but it still not working
what am I doing wrong ? what should I config ?
in app/config/config_dev.yml add:
doctrine:
dbal:
dbname: %database_name%_dev
then you case use this command to create the db
php app/console doctrine:database:create
based on your environment either you will have television or television_dev

Does JBPM require specific database?

I am trying to integrate JBPM with different databases ,so I wanted to ask:
Does JBPM requires any specific Database ?
How to maintain database in JBPM ?
For Example if we need to execute delete statement, where do we set it? In JBPM or in Hibernate?
JBPM use with default a inmemory H2 Database.
But you can configure it to make use of other relational database systems. I was able to use Postgres and MS SQL so far.
Please find further instructions about DB config with in the offical docs: https://docs.jboss.org/jbpm/release/7.3.0.Final/jbpm-docs/html_single/#_using_a_different_database
JBPM comes configured with H2 Database by default, you can change through
persistence.xml the default dialect
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
configure DS on standalone.xml
<jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
When you start your JBoss instance, it should refresh your database ddl's.

Can I use backup/restore to move a database created with EF Code First?

I have an application that uses EF Code First against a SQL Server 2012 database. I'm using the DropCreateDatabaseIfModelChanges initializer.
I have a database on my development machine that I want to move over to my testing machine, and to do that I'm attempting to use backup/restore. Unfortunately, having done that, I get the dreaded "Model compatibility cannot be checked because the database does not contain model metadata" error.
I don't understand why this is the case - the database works OK on my dev machine. Is it not possible to transfer the database to another machine?
Solved: the issue was that the __MigrationHistory table, while present, was not accessible to the application because of insufficient database privileges. I (temporarily) made the user a DBO on the database, and it all worked fine. (Hat tip to Jayantha).
Now the metadata table is removed from the code first DB and added the __MigrationHistory table to system tables. You can try running Enable-Migrations command in Package Manager Console. Here is more details .

How to set up role/membership objects in SQL Server database for ASP.net?

I usually create role/membership database using command:
aspnet_regsql.exe -S (local) -E -A all
but my current web hosting company only allows to create database using phpMyLittleadmin.
How can I manually create database for asp.net role/membership?
In the directory where your aspnet_regsql utility lives (dependent on the .NET framework version you use - probably something like C:\Windows\Microsoft.NET\Framework\v4.0.30319), there's a list of Install*.sql script files that will create the necessary tables for the ASP.NET membership and roles system.
InstallCommon.sql
InstallMembership.sql
InstallPersistSqlState.sql
InstallPersonalization.sql
InstallProfile.SQL
InstallRoles.sql
InstallSqlState.sql
InstallSqlStateTemplate.sql
InstallWebEventSqlProvider.sql
So basically you only need to figure out which script files exactly you need, and which sequence to run them in - and then just ship those (or upload those) to your site and then execute it there.
There's also the same files for uninstalling the tables and the other database objects from your database (called Uninstall*.sql).

Resources