Cloudify Premium 5.0.5 Restful接口开发

前言

记录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
--

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值