You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plume/migrations/postgres/2019-08-03-131154_default_app/up.sql

36 lines
1.1 KiB
SQL

-- Your SQL goes here
--#!|conn: &Connection, path: &Path| {
--#! use plume_common::utils::random_hex;
--#!
--#! let client_id = random_hex();
--#! let client_secret = random_hex();
--#! let app = crate::apps::App::insert(
--#! &*conn,
--#! crate::apps::NewApp {
--#! name: "Plume web interface".into(),
--#! client_id,
--#! client_secret,
--#! redirect_uri: None,
--#! website: Some("https://joinplu.me".into()),
--#! },
--#! ).unwrap();
--#!
--#! for i in 0..=(crate::users::User::count_local(conn).unwrap() as i32 / 20) {
--#! if let Ok(page) = crate::users::User::get_local_page(conn, (i * 20, (i + 1) * 20)) {
--#! for user in page {
--#! crate::api_tokens::ApiToken::insert(
--#! conn,
--#! crate::api_tokens::NewApiToken {
--#! app_id: app.id,
--#! user_id: user.id,
--#! value: random_hex(),
--#! scopes: "read+write".into(),
--#! },
--#! ).unwrap();
--#! }
--#! }
--#! }
--#!
--#! Ok(())
--#!}