Changed the way we point entries. Closes #4.

This commit is contained in:
Alexis Lahouze
2013-01-26 01:15:07 +01:00
parent e4e74eea9f
commit 3cd9304689
8 changed files with 53 additions and 45 deletions

View File

@ -64,13 +64,13 @@ ALTER SEQUENCE account_id_seq OWNED BY account.id;
CREATE TABLE entry (
id bigint NOT NULL,
value_date date NOT NULL,
operation_date date,
label character varying(500) NOT NULL,
comment character varying(500),
value numeric(15,2) NOT NULL,
account_id integer NOT NULL,
category character varying(100)
category character varying(100),
pointed boolean DEFAULT false NOT NULL
);
@ -131,10 +131,10 @@ CREATE INDEX entry_account_id_idx ON entry USING btree (account_id);
--
-- Name: entry_value_date_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
-- Name: entry_operation_date_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX entry_value_date_idx ON entry USING btree (value_date);
CREATE INDEX entry_operation_date_idx ON entry USING btree (operation_date);
--

View File

@ -0,0 +1,10 @@
ALTER TABLE entry ADD COLUMN pointed BOOLEAN NOT NULL DEFAULT false;
UPDATE entry SET pointed = operation_date IS NOT NULL;
UPDATE entry SET operation_date = value_date;
ALTER TABLE entry DROP COLUMN value_date;
CREATE INDEX entry_operation_date_idx ON entry USING btree (operation_date);