前言
记录Cloudify Premium 5.0.5版本Restful接口开发和测试的过程
一、开发流程
1、添加数据表
切换到数据库用户,根据需求添加数据表
#登录数据库
su - postgres
psql -h localhost -d cloudify_db -U cloudify
#密码:cloudify
可以参考Cloudify自带的数据表创建自定义的表,比如sites
pg_dump -h localhost -U cloudify cloudify_db -W -s -t sites > sites.sql
通过查看系统表项,建表过程为:创建字段、设置主键、设置索引、设置外键
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.5.3
-- Dumped by pg_dump version 9.5.3
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: sites; Type: TABLE; Schema: public; Owner: cloudify
--
CREATE TABLE sites (
_storage_id integer NOT NULL,
id text,
visibility visibility_states,
created_at timestamp without time zone NOT NULL,
name text NOT NULL,
latitude double precision,
longitude double precision,
_tenant_id integer NOT NULL,
_creator_id integer NOT NULL
);
ALTER TABLE sites OWNER TO cloudify;
--
-- Name: sites__storage_id_seq; Type: SEQUENCE; Schema: public; Owner: cloudify
--
CREATE SEQUENCE sites__storage_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE sites__storage_id_seq OWNER TO cloudify;
--
-- Name: sites__storage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: cloudify
--
ALTER SEQUENCE sites__storage_id_seq OWNED BY sites._storage_id;
--
-- Name: _storage_id; Type: DEFAULT; Schema: public; Owner: cloudify
--
ALTER TABLE ONLY sites ALTER COLUMN _storage_id SET DEFAULT nextval('sites__storage_id_seq'::regclass);
--
-- Name: sites_pkey; Type: CONSTRAINT; Schema: public; Owner: cloudify
--
ALTER TABLE ONLY sites
ADD CONSTRAINT sites_pkey PRIMARY KEY (_storage_id);
--
-- Name: sites__creator_id_idx; Type: INDEX; Schema: public; Owner: cloudify
--