Subdomain Posts
None | 22 days ago
None | 164 days ago
Python | 164 days ago
None | 164 days ago
Python | 164 days ago
None | 172 days ago
Python | 227 days ago
Python | 227 days ago
None | 227 days ago
Python | 227 days ago
Recent Posts
None | 5 sec ago
None | 8 sec ago
None | 22 sec ago
JavaScript | 48 sec ago
None | 48 sec ago
ActionScript 3 | 1 min ago
HTML | 1 min ago
None | 1 min ago
None | 1 min ago
Bash | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
By mtigas on the 27th of May 2009 10:40:03 PM
Download |
Raw |
Embed |
Report
-- remove the implicit one-to-one since we dont want to inherit anymore
ALTER TABLE "places2_places" DROP CONSTRAINT "places2_places_location_ptr_id_fkey";
-- convert the current inherit one-to-one into an ID field with a counter sequence
ALTER TABLE "places2_places" RENAME "location_ptr_id" TO "id";
CREATE SEQUENCE "places2_places_id_seq";
SELECT SETVAL('places2_places_id_seq',(SELECT "last_value" FROM "places2_location_id_seq")+1);
ALTER TABLE "places2_places" ALTER "id" SET DEFAULT NEXTVAL('places2_places_id_seq'::regclass);
-- since the existing publicplaces' IDs are actually also FKs to a Location,
-- copy the ID over to the location_id field.
ALTER TABLE "places2_places" ADD COLUMN "location_id" integer REFERENCES "places2_location" ("id") DEFERRABLE INITIALLY DEFERRED;
UPDATE "places2_places" SET "location_id"="places2_places"."id";
Submit a correction or amendment below.
Make A New Post