Goal: I’m looking for a declarative and repeatable way of “applying” SQL table schemas to a database What I’ve tried Below is a SQL script that does what I want (as best as I can tell from my superficial knowledge of MySQL and with some manual testing): If the table doesn’t exist, it creates it If the table does exist,
Tag: database-schema
Query updated records in Database
Currently all our tables have a created_at and updated_at timestamp, e.g. The updated_at field is modified with every INSERT. This allows us to query all Cart’s which have been updated since a particular point in time with something like this: However this would not capture updates to FK relationships such as CartItemss and Users. Is there a nice way to
Does ALTER SCHEMA NAME affect permission grants to the schema in Redshift
If i update a schema which has been set up with a bunch of permissions to access other schemas with different access rights, will updating the name undo those grants or will they remain in place? Redshift lists the following on their docs as the syntax to run an alter schema, but does not write if the grants will be
What’s best practice for normalisation of DB where a domain table has an “Other” option for free text?
I’m currently in the process of normalising a database for my company and one pattern I’m seeing a lot in this database is using a domain lookup table for a value but also allowing “Other” and storing the results in a separate column. My question is just whether there is perhaps a cleaner way of representing this? For context I’m
Should I create separate SQL Server database for each user?
I am working on Asp.Net MVC web application, back-end is SQL Server 2012. This application will provide billing, accounting, and inventory management. The user will create an account by signup. just …
Duplicate postgresql schema including sequences
My database layout needs to create new schema for each new customer. Currently I use internal function I found on the net and modified a little bit. CREATE FUNCTION copy_schema( source_schema …