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...
Learn a little bit about the new Pastebin.com on our help page. hide message
By mtigas on the 27th of May 2009 10:40:03 PM Download | Raw | Embed | Report
  1. -- remove the implicit one-to-one since we dont want to inherit anymore
  2. ALTER TABLE "places2_places" DROP CONSTRAINT "places2_places_location_ptr_id_fkey";
  3. -- convert the current inherit one-to-one into an ID field with a counter sequence
  4. ALTER TABLE "places2_places" RENAME "location_ptr_id" TO "id";
  5. CREATE SEQUENCE "places2_places_id_seq";
  6. SELECT SETVAL('places2_places_id_seq',(SELECT "last_value" FROM "places2_location_id_seq")+1);
  7. ALTER TABLE "places2_places" ALTER "id" SET DEFAULT NEXTVAL('places2_places_id_seq'::regclass);
  8.  
  9. -- since the existing publicplaces' IDs are actually also FKs to a Location,
  10. -- copy the ID over to the location_id field.
  11. ALTER TABLE "places2_places" ADD COLUMN "location_id" integer REFERENCES "places2_location" ("id") DEFERRABLE INITIALLY DEFERRED;
  12. UPDATE "places2_places" SET "location_id"="places2_places"."id";
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: