I had a migration that created a table with 2 columns. Ran the migration and it worked. But I realised I would like one of the columns to be a different data type. I dropped the table in my db, changed the migration and ran it again and the table isn't created ? I tried using change() and create()
you need to create a new migration to change columns, don't do that in the old migration, because when you run a migration a new row will be inserted in phinxlog table, and if you try migrate again , phinx will check on phinxlog table what migration has been executed, so deleting table is not enough, you need to delete the inserted row in phinxlog. but it will be good if you create a new migration.
Related
This error is preventing me from running sequelize db:migrate:undo:all.
The globalLinks table is a table I created in my second migration.
There are associations for this table created in a third migration.
There are no associations in any of the remaining models.
Are the objects mentioned in this error log referring to columns? tables? cells?
I know db:migrate:undo:all would undo each migration in reverse order starting from the most recent, so what would remain by the time I try to drop this table?
If it is any clue, I am undoing all of these migrations because the same table is giving me an issue when I try to add a column - I get the error: ERROR: column "userId" of relation "globalLinks" already exists
What's up with this table?
I am using Postgres. It seems very easy to accidentally delete all of a table's data.
For example, I tried to delete one table row and accidentally deleted the whole table contents. This is no problem; the table contained mock data. However, the tables that I create in the future will contain important data.
Example of very easy deletion:
polls_db=# DELETE from polls_choice;
DELETE 8
Is there an easy way in Postgres to restore table data, or to soft delete table data whereby the data can be easily restored?
Working with netezza through jpa. Trying to update row in a simple table, but nothing happens in database. Updating using merge command.
Select works fine. Any ideas?
I'm calling CreateIfNotExists on my EF database object to create the SQL CE file if it doesn't already exist. Up until now it has worked wonderfully. I've created a new table and now when it creates the file it does so without the new table. What is going on?
I tried deleting and re-adding the table and it does the same thing.
What I would like is when one row of a table is updated and a new table that will duplicate the original table will update as well but the problem is the original table is a master table that depends on other tables. Any idea how to do this? I'm very new to postgresql.
This is what triggers are for, assuming that the source and destination tables are in the same DB. In this case I think you need an AFTER INSERT OR UPDATE OR DELETE trigger.
http://www.postgresql.org/docs/current/static/plpgsql-trigger.html