7 import Database.HaskellDB.DBSpec
8 import qualified Database.HaskellDB.DBSpec.PPHelpers as PP
13 dbname = "BlackboardDNS"
16 , makeIdent = PP.mkIdentPreserving
26 , cols = [ CInfo "zone" (StringT, False)
27 , CInfo "ns" (StringT, False)
28 , CInfo "owner" (StringT, False)
29 , CInfo "serial" (IntT , False)
30 , CInfo "refresh" (IntT , False)
31 , CInfo "retry" (IntT , False)
32 , CInfo "expire" (IntT , False)
33 , CInfo "minTTL" (IntT , False)
40 , cols = [ CInfo "name" (StringT, False)
41 , CInfo "zone" (StringT, False)
42 , CInfo "recType" (StringT, False)
43 , CInfo "recData" (StringT, False)
47 -- This kind of dirty hack should go away someday.
48 indexDeclarations :: [String]
50 = [ "CREATE UNIQUE INDEX pkey_on_zones ON zones ( zone )"
51 , "CREATE INDEX pkey_on_records ON records ( name, zone )"
52 , "CREATE TRIGGER insert_into_records\n" ++
53 " BEFORE INSERT ON records\n" ++
59 " WHERE zone = NEW.zone\n" ++
62 " SELECT RAISE(ABORT, \"FK constraint failure\");\n" ++
64 , "CREATE TRIGGER change_record_zone\n" ++
65 " BEFORE UPDATE OF zone ON records\n" ++
71 " WHERE zone = NEW.zone\n" ++
74 " SELECT RAISE(ABORT, \"FK constraint failure\");\n" ++
76 , "CREATE TRIGGER update_zone_name\n" ++
77 " AFTER UPDATE OF zone ON zones\n" ++
80 " UPDATE records\n" ++
81 " SET zone = NEW.zone\n" ++
82 " WHERE zone = OLD.zone;\n" ++
84 , "CREATE TRIGGER delete_zone\n" ++
85 " AFTER DELETE ON zones\n" ++
90 " WHERE zone = OLD.zone;\n" ++