How can I create a custom table in umbraco CMS from a package?
I wanted to create a table in umbraco CMS where I will save my License key and other key values.
Please help in this regard or any other way to save License keys in Umbraco against the package?
Have you looked at the MVC code first approach and the Entity Framework would work perfectly for this. Using DBContext you can do some processes to Create or Drop tables or a table for your package.
Typically when you use the code first approach, the package would run or gets installed, check for an existing table, if exists, skip, if it doesn't exist, create the table.
Most likely you will include the compiled DLL in your package to create the table on install. You should look for the install and uninstall methods for Umbraco packages, because you want to use those to create your DBContext methods, but also if someone uninstalls you package, you want to follow the uninstall process to remove the table as well instead of leaving it.
Create new table in umbraco database from package
How can I create a custom table in umbraco CMS from a package?
I wanted to create a table in umbraco CMS where I will save my License key and other key values. Please help in this regard or any other way to save License keys in Umbraco against the package?
Hi @Amna,
Have you looked at the MVC code first approach and the Entity Framework would work perfectly for this. Using DBContext you can do some processes to Create or Drop tables or a table for your package. Typically when you use the code first approach, the package would run or gets installed, check for an existing table, if exists, skip, if it doesn't exist, create the table.
Most likely you will include the compiled DLL in your package to create the table on install. You should look for the install and uninstall methods for Umbraco packages, because you want to use those to create your DBContext methods, but also if someone uninstalls you package, you want to follow the uninstall process to remove the table as well instead of leaving it.
Hi Amna,
You can use the migrations framework in Umbraco it self to do this.
Have a look at this blog post : https://cultiv.nl/blog/using-umbraco-migrations-to-deploy-changes/
That explains it very well.
Dave
is working on a reply...