Add franchises
This commit is contained in:
parent
1e249f62ce
commit
6cc8f3aa3d
3
Makefile
3
Makefile
|
@ -4,9 +4,10 @@ bbdb = baseballdatabank-2023.1
|
||||||
|
|
||||||
db: baseball.db
|
db: baseball.db
|
||||||
|
|
||||||
baseball.db: baseball-raw.db
|
baseball.db: baseball-raw.db sql/people.sql sql/franchises.sql
|
||||||
rm -f baseball.db
|
rm -f baseball.db
|
||||||
cat sql/people.sql | sqlite3 baseball.db
|
cat sql/people.sql | sqlite3 baseball.db
|
||||||
|
cat sql/franchises.sql | sqlite3 baseball.db
|
||||||
sqlite3 baseball.db "VACUUM"
|
sqlite3 baseball.db "VACUUM"
|
||||||
|
|
||||||
baseball-raw.db:
|
baseball-raw.db:
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
BEGIN;
|
||||||
|
attach database 'baseball-raw.db' as 'raw';
|
||||||
|
CREATE TABLE IF NOT EXISTS "franchises" (
|
||||||
|
"franchID" TEXT,
|
||||||
|
"franchName" TEXT,
|
||||||
|
"active" TEXT,
|
||||||
|
"NAassoc" TEXT,
|
||||||
|
PRIMARY KEY("franchID")
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into franchises
|
||||||
|
select distinct * from 'raw'.'teamsfranchises';
|
||||||
|
COMMIT;
|
|
@ -1,13 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
CREATE TABLE IF NOT EXISTS "pk_teamsfranchises" (
|
|
||||||
"franchID" TEXT,
|
|
||||||
"franchName" TEXT,
|
|
||||||
"active" TEXT,
|
|
||||||
"NAassoc" TEXT,
|
|
||||||
PRIMARY KEY("franchID")
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO "pk_teamsfranchises" SELECT DISTINCT * FROM "teamsfranchises";
|
|
||||||
DROP TABLE "teamsfranchises";
|
|
||||||
ALTER TABLE "pk_teamsfranchises" RENAME TO "teamsfranchises";
|
|
||||||
COMMIT;
|
|
Loading…
Reference in New Issue