IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16244


Ignore:
Timestamp:
Jan 25, 2008, 4:04:46 PM (18 years ago)
Author:
jhoblitt
Message:

redo database schema with foreign keys

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/Changes

    r16238 r16244  
    22
    330.07
     4    - redo database schema with foreign keys
    45    - add Nebulous::Keys pod
    56
  • trunk/Nebulous-Server/Todo

    r16243 r16244  
    77- add support for SQL and/or Apache logging
    88- make copy replicate source attributes, implement as replicate/reparent?
    9 - redo database schema with foreign keys
    109- validation of URIs
    1110- test that client->delete_instance removes the storage object too
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r16224 r16244  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.49 2008-01-25 02:11:23 jhoblitt Exp $
     3# $Id: Server.pm,v 1.50 2008-01-26 02:04:46 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    10041004            $query->finish;
    10051005           
    1006             # if we affected something other then one row something very bad
     1006            # if we affected something other then two rows something very bad
    10071007            # has happened
    10081008            unless ( $rows == 1 ) {
     
    10191019            $query->finish;
    10201020
    1021             # if we affected something other then two rows something very bad
    1022             # has happened
    1023             # this will have to be changed in order to support hardlinks
    1024             unless ( $rows == 2 ) {
     1021            # TODO: this will have to be changed in order to support hardlinks
     1022            unless ( $rows == 1 ) {
    10251023                $log->logdie( "affected row count is $rows instead of 2" );
    10261024            }
  • trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm

    r16181 r16244  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: SQL.pm,v 1.43 2008-01-22 21:27:46 jhoblitt Exp $
     3# $Id: SQL.pm,v 1.44 2008-01-26 02:04:46 jhoblitt Exp $
    44
    55package Nebulous::Server::SQL;
     
    3535    },
    3636    delete_object       => qq{
    37         DELETE
    38             storage_object,
    39             storage_object_attr
    40         FROM storage_object
    41         JOIN storage_object_attr
    42             USING (so_id)
     37        DELETE FROM storage_object
    4338        WHERE storage_object.so_id = ?
    4439    },
     
    310305CREATE TABLE storage_object_attr (
    311306    so_id BIGINT NOT NULL AUTO_INCREMENT,
     307    FOREIGN KEY(so_id) REFERENCES storage_object(so_id) ON DELETE CASCADE,
    312308    read_lock TINYINT DEFAULT 0 NOT NULL,
    313309    write_lock ENUM( 'write' ),
     
    321317CREATE TABLE storage_object_xattr (
    322318    so_id BIGINT NOT NULL AUTO_INCREMENT,
     319    FOREIGN KEY(so_id) REFERENCES storage_object(so_id) ON DELETE CASCADE,
    323320    name VARCHAR(255),
    324321    value BLOB,
     
    331328    ins_id BIGINT NOT NULL AUTO_INCREMENT,
    332329    so_id BIGINT NOT NULL,
     330    FOREIGN KEY(so_id) REFERENCES storage_object(so_id),
    333331    vol_id INT NOT NULL,
    334332    uri VARCHAR(255) NOT NULL UNIQUE,
     
    347345CREATE TABLE lock_record (
    348346    so_id BIGINT NOT NULL,
     347    FOREIGN KEY(so_id) REFERENCES storage_object(so_id),
    349348    type ENUM( 'read', 'write' ) NOT NULL,
    350349    epoch TIMESTAMP,
     
    363362    PRIMARY KEY(vol_id),
    364363    KEY(name(16)),
     364    KEY(path(255)),
    365365    KEY(allocate),
    366366    KEY(available)
     
    391391CREATE TABLE mountedvol(
    392392    mountpoint VARCHAR(255) NOT NULL,
     393    FOREIGN KEY(mountpoint) REFERENCES mount(mountpoint),
    393394    total BIGINT NOT NULL,
    394395    used BIGINT NOT NULL,
    395396    vol_id INT NOT NULL,
     397    FOREIGN KEY(vol_id) REFERENCES volume(vol_id),
    396398    name VARCHAR(255) NOT NULL,
    397399    path VARCHAR(255) NOT NULL,
     400    FOREIGN KEY(path) REFERENCES volume(path),
    398401    allocate BOOLEAN DEFAULT FALSE,
    399402    available BOOLEAN DEFAULT FALSE,
  • trunk/Nebulous/Changes

    r16238 r16244  
    22
    330.07
     4    - redo database schema with foreign keys
    45    - add Nebulous::Keys pod
    56
  • trunk/Nebulous/Todo

    r16243 r16244  
    77- add support for SQL and/or Apache logging
    88- make copy replicate source attributes, implement as replicate/reparent?
    9 - redo database schema with foreign keys
    109- validation of URIs
    1110- test that client->delete_instance removes the storage object too
  • trunk/Nebulous/lib/Nebulous/Server.pm

    r16224 r16244  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.49 2008-01-25 02:11:23 jhoblitt Exp $
     3# $Id: Server.pm,v 1.50 2008-01-26 02:04:46 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    10041004            $query->finish;
    10051005           
    1006             # if we affected something other then one row something very bad
     1006            # if we affected something other then two rows something very bad
    10071007            # has happened
    10081008            unless ( $rows == 1 ) {
     
    10191019            $query->finish;
    10201020
    1021             # if we affected something other then two rows something very bad
    1022             # has happened
    1023             # this will have to be changed in order to support hardlinks
    1024             unless ( $rows == 2 ) {
     1021            # TODO: this will have to be changed in order to support hardlinks
     1022            unless ( $rows == 1 ) {
    10251023                $log->logdie( "affected row count is $rows instead of 2" );
    10261024            }
  • trunk/Nebulous/lib/Nebulous/Server/SQL.pm

    r16181 r16244  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: SQL.pm,v 1.43 2008-01-22 21:27:46 jhoblitt Exp $
     3# $Id: SQL.pm,v 1.44 2008-01-26 02:04:46 jhoblitt Exp $
    44
    55package Nebulous::Server::SQL;
     
    3535    },
    3636    delete_object       => qq{
    37         DELETE
    38             storage_object,
    39             storage_object_attr
    40         FROM storage_object
    41         JOIN storage_object_attr
    42             USING (so_id)
     37        DELETE FROM storage_object
    4338        WHERE storage_object.so_id = ?
    4439    },
     
    310305CREATE TABLE storage_object_attr (
    311306    so_id BIGINT NOT NULL AUTO_INCREMENT,
     307    FOREIGN KEY(so_id) REFERENCES storage_object(so_id) ON DELETE CASCADE,
    312308    read_lock TINYINT DEFAULT 0 NOT NULL,
    313309    write_lock ENUM( 'write' ),
     
    321317CREATE TABLE storage_object_xattr (
    322318    so_id BIGINT NOT NULL AUTO_INCREMENT,
     319    FOREIGN KEY(so_id) REFERENCES storage_object(so_id) ON DELETE CASCADE,
    323320    name VARCHAR(255),
    324321    value BLOB,
     
    331328    ins_id BIGINT NOT NULL AUTO_INCREMENT,
    332329    so_id BIGINT NOT NULL,
     330    FOREIGN KEY(so_id) REFERENCES storage_object(so_id),
    333331    vol_id INT NOT NULL,
    334332    uri VARCHAR(255) NOT NULL UNIQUE,
     
    347345CREATE TABLE lock_record (
    348346    so_id BIGINT NOT NULL,
     347    FOREIGN KEY(so_id) REFERENCES storage_object(so_id),
    349348    type ENUM( 'read', 'write' ) NOT NULL,
    350349    epoch TIMESTAMP,
     
    363362    PRIMARY KEY(vol_id),
    364363    KEY(name(16)),
     364    KEY(path(255)),
    365365    KEY(allocate),
    366366    KEY(available)
     
    391391CREATE TABLE mountedvol(
    392392    mountpoint VARCHAR(255) NOT NULL,
     393    FOREIGN KEY(mountpoint) REFERENCES mount(mountpoint),
    393394    total BIGINT NOT NULL,
    394395    used BIGINT NOT NULL,
    395396    vol_id INT NOT NULL,
     397    FOREIGN KEY(vol_id) REFERENCES volume(vol_id),
    396398    name VARCHAR(255) NOT NULL,
    397399    path VARCHAR(255) NOT NULL,
     400    FOREIGN KEY(path) REFERENCES volume(path),
    398401    allocate BOOLEAN DEFAULT FALSE,
    399402    available BOOLEAN DEFAULT FALSE,
Note: See TracChangeset for help on using the changeset viewer.