aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Databases/LoadingStrictnessLevel.cpp
blob: 8d491ca568921cb725cd7109dd1040c22dd239c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <Databases/LoadingStrictnessLevel.h>
#include <cassert>

namespace DB
{

LoadingStrictnessLevel getLoadingStrictnessLevel(bool attach, bool force_attach, bool force_restore)
{
    if (force_restore)
    {
        assert(attach);
        assert(force_attach);
        return LoadingStrictnessLevel::FORCE_RESTORE;
    }

    if (force_attach)
    {
        assert(attach);
        return LoadingStrictnessLevel::FORCE_ATTACH;
    }

    if (attach)
        return LoadingStrictnessLevel::ATTACH;

    return LoadingStrictnessLevel::CREATE;
}

}