Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I have a plugin released which has a database table that in a next version will have an extra column.
In my application event handler if have the following code:
if (!db.TableExist("customTable")) db.CreateTable<CustomTable>(false);
So if the databse doesn't exists, it will create a new one.
But what with existing tables during a upgrade? What will be the best way to do database changes on existing tables that has already records?
In my case I need an extra column of type int without null values.
/Michaël
You should use migrations - take a look at this article : https://cultiv.nl/blog/using-umbraco-migrations-to-deploy-changes/
It will allow you to both up- and down-grade your plugin (downgrade is used for uninstall).
Hi Soren,
thanks for the link I will have a look at this!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Upgrade custom database table
Hi,
I have a plugin released which has a database table that in a next version will have an extra column.
In my application event handler if have the following code:
So if the databse doesn't exists, it will create a new one.
But what with existing tables during a upgrade? What will be the best way to do database changes on existing tables that has already records?
In my case I need an extra column of type int without null values.
/Michaël
Hi,
You should use migrations - take a look at this article : https://cultiv.nl/blog/using-umbraco-migrations-to-deploy-changes/
It will allow you to both up- and down-grade your plugin (downgrade is used for uninstall).
Hi Soren,
thanks for the link I will have a look at this!
/Michaël
is working on a reply...