postgresql添加字段

ALTER TABLE jiangan_config ADD COLUMN article text NOT NULL DEFAULT '';

pg_dump -s database_name -t table_name
查看表定义:

CREATE TABLE hetong (
    id integer NOT NULL,
    create_time timestamp with time zone NOT NULL,
    edit_time timestamp with time zone NOT NULL,
    check_status integer NOT NULL,
    message text NOT NULL,
    zkzh character varying(50) NOT NULL,
    bscj double precision NOT NULL,
    mscj double precision NOT NULL,
    zcj double precision NOT NULL,
    bspm smallint NOT NULL,
    zpm smallint NOT NULL,
    is_mianshi boolean NOT NULL,
    is_tijian boolean NOT NULL,
    tx character varying(100),
    xm character varying(10) NOT NULL,
    xb character varying(1) NOT NULL,
    hf character varying(1) NOT NULL,
    lxdh character varying(20) NOT NULL,
    bkgw character varying(50) NOT NULL,
    mz character varying(5) NOT NULL,
    zzmm character varying(7) NOT NULL,
    xl character varying(4) NOT NULL,
    xw character varying(4) NOT NULL,
    bysj date,
    byyx character varying(50) NOT NULL,
    zy character varying(50) NOT NULL,
    stzk character varying(2) NOT NULL,
    cjgzsj date,
    xgzdwjgw character varying(50) NOT NULL,
    zgsj character varying(60) NOT NULL,
    jtzz character varying(100) NOT NULL,
    grjl text NOT NULL,
    jcqk text NOT NULL,
    jtzycyqk text NOT NULL,
    creater_id integer NOT NULL,
    is_pay boolean NOT NULL,
    config integer NOT NULL,
    zc character varying(50) NOT NULL,
    zgzs character varying(50) NOT NULL,
    hjszd character varying(50) NOT NULL,
    kssf character varying(10) NOT NULL
);


ALTER TABLE public.jiangan_hetong OWNER TO puser;

--
-- Name: jiangan_hetong_id_seq; Type: SEQUENCE; Schema: public; Owner: puser
--

CREATE SEQUENCE jiangan_hetong_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.jiangan_hetong_id_seq OWNER TO puser;

--
-- Name: jiangan_hetong_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: puser
--

ALTER SEQUENCE jiangan_hetong_id_seq OWNED BY jiangan_hetong.id;


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: puser
--

ALTER TABLE ONLY jiangan_hetong ALTER COLUMN id SET DEFAULT nextval('jiangan_hetong_id_seq'::regclass);


--
-- Name: jiangan_hetong_pkey; Type: CONSTRAINT; Schema: public; Owner: puser; Tablespace: 
--

ALTER TABLE ONLY jiangan_hetong
    ADD CONSTRAINT jiangan_hetong_pkey PRIMARY KEY (id);


--
-- Name: jiangan_hetong_3a252d5f; Type: INDEX; Schema: public; Owner: puser; Tablespace: 
--

CREATE INDEX jiangan_hetong_3a252d5f ON jiangan_hetong USING btree (creater_id);


--
-- Name: jiangan_hetong_creater_id_733fcbc985678220_fk_accounts_user_id; Type: FK CONSTRAINT; Schema: public; Owner: puser
--

ALTER TABLE ONLY jiangan_hetong
    ADD CONSTRAINT jiangan_hetong_creater_id_733fcbc985678220_fk_accounts_user_id FOREIGN KEY (creater_id) REFERENCES accounts_user(id) DEFERRABLE INITIALLY DEFERRED;


--
-- PostgreSQL database dump complete
--
posted @ 2016-02-29 17:59  LisPythoniC  阅读(20414)  评论(0编辑  收藏