Skip to content

Instantly share code, notes, and snippets.

@dorkness-io
Last active April 9, 2020 17:56
Show Gist options
  • Save dorkness-io/92ee7a14c824b017550bab0adb2a6405 to your computer and use it in GitHub Desktop.
Save dorkness-io/92ee7a14c824b017550bab0adb2a6405 to your computer and use it in GitHub Desktop.
/* Let's create a table */
create table some_table (
id integer unique
,some_column text
,other_column numeric
);
/* Let's add a column */
alter table some_table
add column another_column text;
/* Let's rename the table */
alter table some_table
rename to test_table;
/* Not DDL, but we need a row of data */
insert into test_table values(1,'foo',100);
/* Whoops we missed a column! Let's truncate the table and re-create that row */
truncate test_table;
insert into test_table values(1,'foo',100,'bar');
/* Ok, we're done, let's drop the table */
drop table test_table;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment